arg.index = param;
arg.value = value;
- if (mlock(&arg, sizeof(arg)) != 0)
+ if (lock_pages(&arg, sizeof(arg)) != 0)
return -1;
rc = do_xen_hypercall(handle, &hypercall);
- safe_munlock(&arg, sizeof(arg));
+ unlock_pages(&arg, sizeof(arg));
return rc;
}
arg.domid = dom;
arg.index = param;
- if (mlock(&arg, sizeof(arg)) != 0)
+ if (lock_pages(&arg, sizeof(arg)) != 0)
return -1;
rc = do_xen_hypercall(handle, &hypercall);
- safe_munlock(&arg, sizeof(arg));
+ unlock_pages(&arg, sizeof(arg));
*value = arg.value;
return rc;
image_size = (image_size + PAGE_SIZE - 1) & PAGE_MASK;
- if (mlock(&st_ctxt, sizeof(st_ctxt))) {
- PERROR("Unable to mlock ctxt");
+ if (lock_pages(&st_ctxt, sizeof(st_ctxt))) {
+ PERROR("Unable to lock_pages ctxt");
return 1;
}
launch_domctl.cmd = XEN_DOMCTL_setvcpucontext;
rc = do_domctl(xc_handle, &launch_domctl);
+ unlock_pages(&st_ctxt, sizeof(st_ctxt));
return rc;
error_out:
free(image);
+ unlock_pages(&st_ctxt, sizeof(st_ctxt));
return -1;
}
goto out;
}
- if (mlock(&ctxt, sizeof(ctxt))) {
+ if (lock_pages(&ctxt, sizeof(ctxt))) {
/* needed for build domctl, but might as well do early */
- ERROR("Unable to mlock ctxt");
+ ERROR("Unable to lock_pages ctxt");
return 1;
}
if (page_array != NULL)
free(page_array);
+ unlock_pages(&ctxt, sizeof(ctxt));
+
DPRINTF("Restore exit with rc=%d\n", rc);
return rc;
/* Initially all the pages must be sent. */
memset(to_send, 0xff, bitmap_size);
- if (mlock(to_send, bitmap_size)) {
- ERROR("Unable to mlock to_send");
+ if (lock_pages(to_send, bitmap_size)) {
+ ERROR("Unable to lock_pages to_send");
goto out;
}
- if (mlock(to_skip, bitmap_size)) {
- ERROR("Unable to mlock to_skip");
+ if (lock_pages(to_skip, bitmap_size)) {
+ ERROR("Unable to lock_pages to_skip");
goto out;
}
}
free(page_array);
+ unlock_pages(to_send, bitmap_size);
free(to_send);
+ unlock_pages(to_skip, bitmap_size);
free(to_skip);
if (live_shinfo)
munmap(live_shinfo, PAGE_SIZE);